//Copyright (C) 2009 Ron Coleman. Contact: ronncoleman@gmail.com
//
//This library is free software; you can redistribute it and/or
//modify it under the terms of the GNU General Public License
//as published by the Free Software Foundation; either
//version 3 of the License, or (at your option) any later version.
//
//This library is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with this library; if not, write to the Free Software
//Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

package org.workplicity.android.cia.util;

import org.workplicity.android.cia.model.Comment;
import org.workplicity.android.cia.model.LocalWorkRequest;
import org.workplicity.android.cia.model.User;

/**
 * Class that creates test data until the connection to the database
 * is established
 * 
 * Singleton pattern ensures that there is only one set of test data
 * created in memory
 * 
 * @author brian.gormanly
 *
 */

public class BootStrap {
	
	public static LocalWorkRequest[] lwrArray;
	
	private static final BootStrap instance = new BootStrap();
	
	// data to use
	protected static User[] users = new User[5];
	protected static String[] descriptions = new String[30];
	protected static Comment[] comments = new Comment[30];
	protected WorkDate[] requestDate = new WorkDate[30];
    protected WorkDate[] assignedDate = new WorkDate[30];
    protected WorkDate[] completeDate = new WorkDate[30];
	
	
	private BootStrap() {
		// initailize the array of 30 work requests
		lwrArray = new LocalWorkRequest[30];
		
		// create static data to use
		descriptions[0] = "Install Light Fixture";
		descriptions[1] = "Fix Toliet";
		descriptions[2] = "Update Garden";
		descriptions[3] = "Check vents";
		descriptions[4] = "Pluming problem with drain";
		descriptions[5] = "Install toliet";
		descriptions[6] = "Problem with light switch";
		descriptions[7] = "Paint Foyer";
		descriptions[8] = "Clean storm drain";
		descriptions[9] = "Cover garden with tarp";
		descriptions[10] = "Check roof for reported leak";
		descriptions[11] = "Install new sink";
		descriptions[12] = "Carpets need cleaning";
		descriptions[13] = "Wax hall floor";
		descriptions[14] = "Light bulbs need to be checked";
		descriptions[15] = "Fire detector testing";
		descriptions[16] = "Paint the room";
		descriptions[17] = "Door glass cracked";
		descriptions[18] = "Problem with light switch";
		descriptions[19] = "Room to hot";
		descriptions[20] = "Clogged sink";
		descriptions[21] = "Soap dispenser broken";
		descriptions[22] = "Basement flooded";
		descriptions[23] = "Light broken";
		descriptions[24] = "Light bulb check";
		descriptions[25] = "Programmers are cranky";
		descriptions[26] = "Too Cold";
		descriptions[27] = "Sink cracked";
		descriptions[28] = "Just right";
		descriptions[29] = "Table broken";
		
		//users[0] = createUser();
		//users[1] = createUser();
		//users[2] = createUser();
		//users[3] = createUser();
		//users[4] = createUser();
		//users[5] = createUser();
		
		comments[0] = createComment("");
		comments[1] = createComment("");
		comments[2] = createComment("");
		comments[3] = createComment("");
		comments[4] = createComment("");
		comments[5] = createComment("");
		comments[6] = createComment("");
		comments[7] = createComment("");
		comments[8] = createComment("");
		comments[9] = createComment("");
		comments[10] = createComment("");
		comments[11] = createComment("");
		comments[12] = createComment("");
		comments[13] = createComment("");
		comments[14] = createComment("");
		comments[15] = createComment("");
		comments[16] = createComment("");
		comments[17] = createComment("");
		comments[18] = createComment("");
		comments[19] = createComment("");
		comments[20] = createComment("");
		comments[21] = createComment("");
		comments[22] = createComment("");
		comments[23] = createComment("");
		comments[24] = createComment("");
		comments[25] = createComment("");
		comments[26] = createComment("");
		comments[27] = createComment("");
		comments[28] = createComment("");
		comments[29] = createComment("");
		
		
		
		// create the data to use
		for(int i=0; i<30; i++) {
			
		}
		
	}
	
	public static BootStrap getInstance() {
        return instance;
    }
	
	private User createUser(String firstName, String lastName, User.Type type) {
		User thisUser = new User();
		thisUser.setFirstName(firstName);
		thisUser.setLastName(lastName);
		thisUser.setType(type);
		return thisUser;
	}
	
	private Comment createComment(String comment) {
		Comment thisComment = new Comment();
		thisComment.setDate(new WorkDate(System.currentTimeMillis()));
		thisComment.setText(comment);
		//thisComment.setUserId(userId);
		return thisComment;
	}
	
	
	
}
